#include <Cocoa/Cocoa.h>
#include <Sparkle/Sparkle.h>
-#include <Sparkle/SUUpdater.h>
#include <AppKit/NSApplication.h>
#include "common/utility.h"
~SparkleInterface()
{
- [updater release];
+ [updaterController release];
[delegate release];
}
emit q->statusChanged();
}
- SUUpdater* updater;
+ SPUStandardUpdaterController *updaterController;
NCSparkleUpdaterDelegate *delegate;
private:
_interface->delegate = [[NCSparkleUpdaterDelegate alloc] initWithOwner:_interface.get()];
[_interface->delegate retain];
- _interface->updater = [SUUpdater sharedUpdater];
- [_interface->updater setDelegate:_interface->delegate];
- [_interface->updater setAutomaticallyChecksForUpdates:YES];
- [_interface->updater setAutomaticallyDownloadsUpdates:NO];
- [_interface->updater setSendsSystemProfile:NO];
- [_interface->updater resetUpdateCycle];
- [_interface->updater retain];
+ _interface->updaterController =
+ [[SPUStandardUpdaterController alloc] initWithStartingUpdater:YES
+ updaterDelegate:_interface->delegate
+ userDriverDelegate:nil];
+ [_interface->updaterController retain];
setUpdateUrl(appCastUrl);
// Sparkle 1.8 required
const auto userAgentString = QString::fromUtf8(Utility::userAgentString());
- NSString *userAgent = userAgentString.toNSString();
- [_interface->updater setUserAgentString: userAgent];
+ NSString *const userAgent = userAgentString.toNSString();
+ _interface->updaterController.updater.userAgentString = userAgent;
}
SparkleUpdater::~SparkleUpdater() = default;
void SparkleUpdater::setUpdateUrl(const QUrl &url)
{
- [_interface->updater setFeedURL:url.toNSURL()];
+ _interface->updaterController.updater.feedURL = url.toNSURL();
}
bool SparkleUpdater::autoUpdaterAllowed()
{
qCInfo(OCC::lcUpdater) << "Checking for updates.";
if (autoUpdaterAllowed()) {
- [_interface->updater checkForUpdates: NSApp];
+ [_interface->updaterController.updater checkForUpdates];
}
}
{
if (autoUpdaterAllowed() && !ConfigFile().skipUpdateCheck()) {
qCInfo(OCC::lcUpdater) << "launching background check";
- [_interface->updater checkForUpdatesInBackground];
+ [_interface->updaterController.updater checkForUpdatesInBackground];
} else {
qCInfo(OCC::lcUpdater) << "not launching background check, auto updater not allowed or update check skipped in config";
}